﻿using System;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace HYOpeningDetail
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class CmdOpeningDetail : IExternalCommand
	{
		public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
		{
			OpeningDetailManager openingDetailManager = new OpeningDetailManager(commandData);
			Result result;
			try
			{
				if (openingDetailManager.FunctionStart())
				{
					result = Autodesk.Revit.UI.Result.Succeeded;
				}
				else
				{
					result = Autodesk.Revit.UI.Result.Failed;
				}
			}
			catch (Exception)
			{
				result = Autodesk.Revit.UI.Result.Failed;
			}
			return result;
		}
	}
}
